﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MapManage : MonoBehaviour
{
    const string mapPath = "Map/";
    public static List<Vector3> LoadPath(string map)
    {
        TextAsset mapInfo = Resources.Load<TextAsset>(mapPath + map);
        List<Vector3> roadPoint = new List<Vector3>();
        if(mapInfo==null)
        {
            Debug.Log("不存在此文件");
        }
        else
        {
            string sInfo = mapInfo.text;
            string[] bInfo = sInfo.TrimEnd('\n').Split('\n');
            for (int i=0;i<bInfo.Length;i++)
            {
                string[] s = bInfo[i].Split(',');
                int x = int.Parse(s[0]);
                int z = int.Parse(s[1]);
                roadPoint.Add(new Vector3(x, 0, z));
            }
        }
        return roadPoint;
    }
    
}
